<template>
  <el-container>
    <el-header class="box-shadow border-bottom">
      <AppHeader></AppHeader>
    </el-header>
    <el-main>
      <nuxt />
      <Backtop></Backtop>
    </el-main>
    <AppFooter></AppFooter>
  </el-container>
</template>

<script>
export default {
  async fetch() {
    //获取菜单列表
    await this.$api_menu.getList().then(res => {
      let list = {
        name: "更多",
        list: []
      };
      let menuList = [];
      if(res.code === 200){
        for (let i = 0; i < res.data.length; i++) {
          let menu = res.data[i];
          if((i+1) > 6){
            list.list.push(menu);
          }else{
            menuList.push(menu);
          }
        }
        if(list.list.length > 0){
          menuList.push(list);
        }
      }
      this.$store.dispatch("set_menu", menuList);
    });
  }
}
</script>
